<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">单页内容</div>
                <div class="layui-card-body" pad15>
                    <div class="layui-form layui-form-pane">
                        {volist name="title" id="vo"}
                        <div class="layui-form-item">
                            <label class="layui-form-label">{$vo}</label>
                            <div class="layui-input-block">
                                <script id="{$key}" type="text/plain">{:array_get($data,$key)}</script>
                            </div>
                        </div>
                        {/volist}
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="{$lay_btn}">确认修改</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/ueditor" /}
<script>
    let form_field = {:json_encode($title)};
    layui.use(['index', 'form'], function () {
        for (let key in form_field) {
            UE.getEditor(key);
        }

        const admin = layui.admin;
        const form = layui.form;
        form.render();

        form.on('submit({$lay_btn})', function (obj) {
            for (let key in form_field) {
                obj.field[key] = UE.getEditor(key).getContent();
            }
            admin.req({
                url: "{:url('page/edit')}",
                type: 'post',
                data: obj.field,
                done: function (res) {
                    layer.msg("提交成功", {icon: 1});
                }
            });

        });
    });
</script>
